package com.ecmcloud.resource;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.ecmcloud.common.dto.Result;
import com.ecmcloud.entity.ProcessGroup;
import com.ecmcloud.service.IProcessGroupService;

@RestController
@RequestMapping(value = {"processGroup", "api/processGroup"})
public class ProcessGroupResource {

	@Autowired
    private IProcessGroupService processGroupService;

    /**
     * 组列表
     *
     * @return
     */
    @GetMapping("list")
    public Result<List<ProcessGroup>> queryList() {
        return processGroupService.queryList();
    }

    /**
     * 新增流程分组
     *
     * @param processGroup 分组名
     * @return 添加结果
     */
    @PostMapping("create")
    public Result<String> create(@RequestBody ProcessGroup processGroup) {
        return processGroupService.create(processGroup);
    }


    /**
     *  删除分组
     * @param id
     * @return
     */
    @DeleteMapping("delete/{id}")
    public Result<String> delete(@PathVariable long id){
        return processGroupService.delete(id);
    }
}
